<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title th:text="${articleById.getTitle()}">标签栏提示信息</title>
    <div th:include="common :: headcommon"></div>
    <script th:src="@{/js/index/article_details.js}" type="text/javascript"></script>
</head>
<body>
<div th:replace="common :: #top_start"></div>


<div class="layui-container container">
    <div class="layui-row layui-col-space20">
        <div class="layui-col-md1"></div>
        <div class="layui-col-md10">
            <div>
          <span class="layui-breadcrumb">
              <a href="/index">首页</a>
              <!--              <a href="/article">新闻</a>-->
              <a th:href="@{/cate/CateArticle/{cid}(cid=${articleById.cid})}">[[${articleById.category.cname}]]</a>
              <a><cite th:text="${articleById.getTitle()}">标题信息</cite></a>
    	</span>
                <hr class="layui-bg-red">
                <div class="content" id="photos">
                    <h2 class="c_titile" th:text="${articleById.getTitle()}">文章标题</h2>
                    <p class="box_c"><span class="d_time">发布时间：[[${#dates.format(articleById.createTime, 'yyyy-MM-dd HH:mm')}]]</span>
                        <span>作者：[[${articleById.user.newsName}]]</span><span>阅读（[[${articleById.checkNum}]]）</span>
                    </p>
                    <div class="detail-body">

                        <div th:utext="${articleById.content}">文章内容</div>

                    </div>

                    <fieldset class="layui-elem-field layui-field-title" style="margin: 0px 0px; text-align: center;">
                        <!--                                <legend><a  href="#" th:href="@{temp/{id}(id=${articleById.getId()})}">收藏</a></legend>-->
                        <legend><a th:onclick="fav(this,[[${articleById.id}]])">收藏</a></legend>
                    </fieldset>
                    <!--                    评论区-->
<!--                    无评论-->
                    <div th:if="${#lists.isEmpty(commentList)}"><h1 class="no_comment" >暂无评论，赶紧来发表评论吧</h1></div>
<!--                    有评论-->
                    <div class="detail-box" >
                        <!--                            <a name="comment"></a>-->
                        <ul class="jieda" id="jieda" th:if="!${#lists.isEmpty(commentList)}">

                            <li th:each="comment,stat:${commentList}">
                                <a name="item-121212121212"></a>
                                <div class="detail-about detail-about-reply" th:each="user:${comUser}"
                                     th:if="${comment?.uid==user?.uid}">
                                    <div class="jie-user">
                                        <img src="/images/none.jpg" alt="用户头像" th:src="@{${user?.headImage}}">
                                        <cite>
                                            <i th:text="${user?.newsName}">用户名</i>
                                        </cite>
                                    </div>

                                    <div class="detail-hits">
                                        <span>发表于[[${#dates.format(comment?.comTime, 'yyyy-MM-dd HH:mm')}]]</span>
                                    </div>
                                    <div class="comment_floor">
                                        [[${stat.count}]]楼
                                    </div>
                                </div>
                                <!--                                      评论内容-->
                                <div class="detail-body jieda-body" value="" th:utext="${comment?.content}">
                                    评论的主体内容
                                    <p>蓝瘦</p>
                                </div>
                            </li>
                        </ul>
                        <!--分页，暂未考虑-->
                        <!--                          	<div id="page_reply"></div>-->
                        <form>
                            <div class="layui-form layui-form-pane">
                                <input type="hidden" name="aid" th:value="${articleById.getId()}">
                                <div class="layui-form-item layui-form-text">
                                    <div class="layui-input-block">
                                        <textarea id="reply" name="content" lay-verify="content"
                                                  class="layui-textarea fly-editor"></textarea>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <input type="button" class="layui-btn" lay-filter="subComment" lay-submit
                                           value="发表评论"/>
                                    <!--                                  <input type="button" class="layui-btn" onclick="getReply();" lay-filter="*" lay-submit value="发表评论"/>-->
                                </div>
                            </div>
                        </form>
                    </div>

                </div>
            </div>
        </div>

    </div>
</div>


<div th:replace="common :: #foot_start"></div>
<script>
    //图片放大 预览显示
    layer.photos({
        photos: '#photos'
        , anim: 0 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
    });
//进行收藏
    function fav(obj, id) {
        $.post("/article/fav", {"id": id}, function (data) {
            console.log(data);
            // var flag=data
            if (data.flag == 200) {
                layer.msg(data.msg, {icon: 1, time: 3000});
                // setTimeout(function () {window.location.href='/back/article/review';},2000);

            }
            if (data.flag == 400 || data.flag == 401||data.flag == 402) {
                layer.msg(data.msg, {icon: 0, time: 3000});
                //  setTimeout(function () {window.location.href='/back/cate';},2000);
            }
        });
    }
</script>
</body>
</html>
